#include "stdafx.h"
#include "Member.h"


Member::Member(void)
{
}


Member::~Member(void)
{
}

int Member::getID() 
{
	return _id;
	
}

MemberDetails Member::getDetails()
{
	return _details;
}

void Member::setDetails(MemberDetails details_)
{
	
	_details = details_;
	ENSURE0(_details.getUserName() == details_.getUserName());
}

bool Member::changePassword(string oldPassword_, string newPassword_)
{
	//REQUIRE0(strcmp(oldPassword_,newPassword_ ));

	_db.connect();
	if (_db.checkPassword(oldPassword_))
	
	{
		_db.editPassword(newPassword_);
		_db.close();
		return true;
	}
	else return false;

}

void Member::addReservation(Movie movie_)
{
	_db.connect();
	_db.reserveFilm(movie_.getID(), _id);
	_db.close();
}

void Member::RemoveReservarion(Movie movie_)
{
	_db.connect();
	_db.cancelResevedMovie(movie_.getID());
	_db.close();
}
